﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetPrivateNum.aspx.cs" Inherits="ZX.WebApp.Crm.Customer.SetPrivateNum" %>


<%@ Register Assembly="ZX.Web.UI.Controls" Namespace="ZX.Web.UI.Controls.UserControl"
    TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table style="width: 100%; height: 100%;">
        
            <tr valign="bottom">
                <td style="text-align: right;">
                    所属部门
                </td>
                <td colspan="3">
                    <cc1:DeptList ID="DeptList1" runat="server"></cc1:DeptList>
                    <%--<asp:DropDownList ID="drpDept" runat="server" Width="155px" AppendDataBoundItems="true"
                        AutoPostBack="True" OnSelectedIndexChanged="drpDept_SelectedIndexChanged">
                        <asp:ListItem Value="00">--选择部门过滤--</asp:ListItem>
                    </asp:DropDownList>--%>
                </td>
            </tr>
            <tr valign="bottom">
                <td>&nbsp;</td>
                <td colspan="2">
                    <input type="text" id="txtSearch" name="txtSearch" style="width: 95px;" />
                    <input type="button" id="btnSearch" name="btnSearch" onclick="SearchName()" value="查找"
                        class="btnCheck" style="width: 50px; height: 20px;" />
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    人员列表
                </td>
                <td>
                    <asp:ListBox ID="lstBoxSubject" runat="server" Height="220px" Width="155px"></asp:ListBox>
                </td>
                <td>
                    <button id="add" type="button" style="width: 55px;" class="btnCheck">
                        ></button><br />
                    <br />
                    <button id="add_all" type="button" style="width: 55px;" class="btnCheck">
                        >></button><br />
                    <br />
                    <br />
                    <button id="remove" type="button" style="width: 55px;" class="btnCheck">
                        <</button><br />
                    <br />
                    <button id="remove_all" type="button" style="width: 55px;" class="btnCheck">
                        <<</button>
                </td>
                <td>
                    <asp:ListBox ID="lstBoxResult" runat="server" Height="220px" Width="155px"></asp:ListBox>
                </td>
            </tr>
            <tr><td colspan="4">&nbsp;</td></tr>
            <tr>
            <td style="text-align: right;">设置私海人数</td>
             <td colspan="3"> 
             <input id="PrivateNum" type="text" onkeyup="this.value=this.value.replace(/\D/g,'')"
                            onafterpaste="this.value=this.value.replace(/\D/g,'')" runat="server" maxlength="3" />
             </td>
        </tr>
            <asp:HiddenField ID="hdnUid" runat="server" />
            <asp:HiddenField ID="hiddenId" runat="server" />
            <asp:HiddenField ID="hiddenDId" runat="server" />
            <asp:HiddenField ID="hiddenType" runat="server" />
            <asp:HiddenField ID="hiddenEntity" runat="server" />
        </table>
    </div>
    </form>
    <form id="form2" style="display: none" action="../../Extend/AjaxData/CustomOperating.aspx">
    <textarea style="display: none" id="jsonDataContent" rows="2" cols="2" name="jsonDataContent"></textarea>
    </form>
</body>
<script src="../../Scripts/Appjs/model.V_CrmPrivateNumSet.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
    $(function () {
        //移到右边
        $('#add').click(function () {
            //获取选中的选项，删除并追加给对方
            $('#lstBoxSubject option:selected').appendTo('#lstBoxResult');
        });
        //移到左边
        $('#remove').click(function () {
            $('#lstBoxResult option:selected').appendTo('#lstBoxSubject');
        });
        //全部移到右边
        $('#add_all').click(function () {
            //获取全部的选项,删除并追加给对方
            $('#lstBoxSubject option').appendTo('#lstBoxResult');
        });
        //全部移到左边
        $('#remove_all').click(function () {
            $('#lstBoxResult option').appendTo('#lstBoxSubject');
        });
        //双击选项
        $('#lstBoxSubject').dblclick(function () { //绑定双击事件
            //获取全部的选项,删除并追加给对方
            $("option:selected", this).appendTo('#lstBoxResult'); //追加给对方
        });
        //双击选项
        $('#lstBoxResult').dblclick(function () {
            $("option:selected", this).appendTo('#lstBoxSubject');
        });
    });

    //关闭弹出窗体
    function closeWin() {
        YAHOO.example.container.dialog1.hide();
    }

    function ChangeDept() {
        var deptId = $('#SelectForDept').val();
        if (deptId == "" || deptId == null) {
            alert("请选择部门!");
        } else {
            var deptIndex = $("#SelectForDept").get(0).selectedIndex;
            document.getElementById('lstBoxSubject').length = 0;
            if (deptIndex == 0) {
                return;
            } else {
                var url = "../../Extend/AjaxData/CustomOperating.aspx?action=check&entity=V_DatEmployeeForUser&id=" + deptId;
                YAHOO.util.Connect.asyncRequest('POST', url, {
                    success: function (res) {
                        var inventory;
                        try {
                            inventory = res.responseText;
                            var Employee = [];
                            var obj = eval(inventory);
                            for (var i = 0; i < obj.length; i++) {
                                $('#lstBoxSubject').append('<option value=' + obj[i].UserID + '>' + obj[i].Name + '(' + obj[i].DeptName + ":" + obj[i].EmpCode + ')</option>');
                            }
                        }
                        catch (e) {
                        }
                        finally {
                        }
                    },
                    failure: function (error) {
                        alert("数据错误：" + error.statusText);
                    }
                }, null);
            }
        }
    }


</script>
</html>
